   function deleteLastChar(str,c){
	var reg=new RegExp(c+"([^"+c+"]*?)$");
	return str.replace(reg,function(w){
	if(w.length>1){
	       return w.substring(1);
	     }else{
	        return "";
	     }
	     });
   }
   
   function sendMsg(){
	      var names = "";
	      var phones = "";
	    $("table tr td div div input:checked").each(function(){
	        names = names+this.value+",";
	         phones = phones+$(this).attr("name")+",";
	    });
	      
	       if(names == null || names == ""){
	           alert("发送对象不能为空!");
	           return;
	       }else{
	         var n = deleteLastChar(names,",");
	         $("#names").html(n);
	        $('#sendMsgDialog').dialog({
	        modal : true,
			show : "blind",
			hide : "blind",
			width : 620,
			height : 400,
				buttons : {
			"发送 " : function() {
		
		var content = $('#contents').val();
	    sendMessageAction.sendMessage(phones,content,function(data){
			    var flag = data.flag;
			    var result = data.result;
			    alert(data);
			    if(flag == false){
			       if(content.length >= 70){
			       alert("对不起,发送内容超过70个字,你现在超的的字数是" +(content.length-70)+ "个.");
			       } else if(result == "-1"){
			           alert("对不起,没有该用户账户");
			       } else if(result == "-2"){
			           alert("对不起,密钥不正确（不是用户密码）");
			       } else if(result == "-3"){
			           alert("对不起,你的短信数量不足");
			       } else if(result == "-11"){
			           alert("对不起,该用户被禁用");
			       } else if(result == "-14"){
			           alert("对不起,短信内容出现非法字符");
			       } else if(resutl == "-4"){
			           alert("对不起,手机号格式不正确 ");
			       } else if(result == "-41"){
			           alert("对不起,手机号码为空");
			       } else if(result == "-42"){
			           alert("对不起,短信内容为空");
			       }
			    } 
			    
			    if(flag == true){
			        alert("发送成功 .一共发了"+result+"条短信!");			    
			    }
				$(this).dialog("close");  
			   });
			   },
			"关闭" : function() {
					$(this).dialog("close");
				}
		}
	        });
	        }
	   }
   
	function GetQueryString(name){
	     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	     var r = window.location.search.substr(1).match(reg);
	     if(r!=null)return  unescape(r[2]); return null;
	      }
	
	function evalDwrData(data) {
		if (!data) {
			return null;
		}
		if (data == "") {
			return null;
		}
		return eval(data);
	     }
